Repository navigation
fix(lint, metadata-protocol)!: the object_extension publish door folds the written entry among other packages' extensions by priority, as os build does - #33702
Conversation
…itten entry among other packages' extensions by priority The door's target carried every other package's extension field as a plain field with no priority, so the gate served the written entry's definition of every field it adds, and its formula-cycle verdict differed from os build on a tie, on an outranked entry, and on a higher sibling's cycle through another field of the entry. The host now states the target's other packages' published extensions (registry contributors, disabled packages left out), and objectExtensionsByTarget / objectsAsServed fold the written entry among them, the build's own fold, ties dropped. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pZiFTTaXqbY34YRcV
…as plumbing receivers Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pZiFTTaXqbY34YRcV
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5pZiFTTaXqbY34YRcV
📓 Docs Drift CheckThis PR changes 3 package(s): 21 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 173 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin eea65925b461acffe19e0618c5cfa81640cb921b && git checkout eea65925b461acffe19e0618c5cfa81640cb921b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6ff3eee7ca595cf1bb5c47e9fc09bb127c0a57d0 763105ecec86da5d14ba9b8d70c55e1644ff7e49 && git checkout -B drift-repro 6ff3eee7ca595cf1bb5c47e9fc09bb127c0a57d0 && git merge --no-ff 763105ecec86da5d14ba9b8d70c55e1644ff7e49
node scripts/docs-audit/affected-docs.mjs --json 6ff3eee7ca595cf1bb5c47e9fc09bb127c0a57d0
|
|
domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag Contract reviewServed-tier: PR #33702 for card #33494. Inputs read: the card body and its five comments (carry note 6886038545, claim 6888533455, surface amendment 6888588670, dev report 6890640694), the PR body and file list (16 files), the net diff against Check-runs on the head (64): 21 success, 10 skipped, 0 failed, 33 with no conclusion yet at review time (15 in progress, 18 queued). Concluded green: Check Changeset, PR-body guards, Governed Surface Queue Guard, Spec property liveness, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Check Documentation Links, Check PR Size, Dogfood Regression Gate. Not yet concluded: Build Core, Test Core 1-8, Type Check (workspace, consumer gates, debt ledger), Lint (CI release and engine gates, query-options erasure), Live E2E UI, Type Check UI, Build and E2E UI, Test UI 1-16. This record judges the contract; it does not stand in for those verdicts, and landing waits for them to conclude green. ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Attempts to break it, none of which did:
Implementing files, sentence by sentence. Pins. The #33153 pin "the door judges the written entry's own definition whatever a sibling's priority" is replaced; shapes 1 and 2 now assert no finding at the door and none in the build; shape 3 asserts a refusal at the door on Findings.
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
domain:spec#1 · os-project-manager · session_01FEkQ5mswnWm181XgYcCUag ACCEPT · PR #33702 (#33494) · head
|
Requested by Leehom · project thread
Fixes #33494
Clause-②: no (narrowing) — at the runtime
object_extensionpublish door (Studio,PUT /api/v1/meta/object_extension/TARGET, the MCP and AI authoring doors) the expression rule now reads each field of the target asos buildserves it when another package's published extension adds the same field. One shape it accepted is now refused (shape 3: a higher-priority package's formula for a field the written entry also adds closes a cycle through another field of the entry), and two it refused now publish (shape 1, a tie at the priority that decides the field; shape 2, the written entry outranked there).os build,os validateandos lintare unchanged. The new gate input (storedObjectExtensionsonrunRuntimeAuthoringRulesandevaluateRuntimeAuthoringGate, theStoredObjectExtensiontype from@objectstack/lint/runtime) is optional and additive. Measured first-party exposure: no two first-party packages extend the same object (examples/app-showcaseone entry onshowcase_account;packages/plugins/plugin-authone onsys_sso_provider; HotCRMorigin/main2492ac6 one module, o2c, extendingcrm_contractandcrm_account), so no first-party write changes verdict.Metadata-protocol: narrowed
Skills-docs: none owed — this PR edits
content/docs/deployment/validating-metadata.mdx(the object extension paragraph states the door's fold); the skills teachdefineObjectExtension({ extend, fields, priority })and formula fields and say nothing of how the door read a field two packages add.维护者速读
object_extension发布口在判断扩展字段(如公式循环)时,现在把其他软件包已发布的同目标扩展连同其优先级一起折叠,用的是os build的同一个折叠函数,所以发布口看到的字段定义与 build 一致:同优先级冲突的字段两边都不判,被更高优先级覆盖的字段按覆盖者的定义判。packages/lint/src/validate-expressions.ts(扩展遍历:stored 条目只折叠不判定、回填跳过 stored 名称)、packages/lint/src/object-graph.ts(objectExtensionsByTarget/objectsAsServed的stored参数)、packages/metadata-protocol/src/protocol-authoring-gate.ts(otherPackagesExtensionsOf)。pnpm --filter @objectstack/lint exec vitest run src/runtime-gate.object-formula-cycle.test.ts,预期 20 条全过,其中#33494一组 5 条:同优先级与被覆盖两种情形发布口与 build 都放行,更高优先级兄弟公式构成的循环在发布口按本条目的字段拒绝。What changes
packages/lint/src/object-graph.ts.objectExtensionsByTarget(stack, stored = [])andobjectsAsServed(stack, stored = [])take an optional list ofStoredObjectExtension(an extension the host's registry already holds for another package:extend,priority,fields,packageId). Each is collected by the fold's owncollect, one carrier per entry below 0 (registered before the stack's own entries), markedstored: trueon itsVisibleObjectExtension. They sort and fold exactly as any entry: ascending priority, a later writer replacing the whole field, a name whose deciding writers share a priority put intied. The build never passes the list, so every build verdict is what it was.packages/lint/src/validate-expressions.ts.StackExpressionOptions.storedObjectExtensions, read on anobject_extensionwrite only (storedExtensions). It reaches the top-of-pass fold (objectsAsServed(stack, storedExtensions), so the field, type and nullable indexes see the build's winner and leave a tie out) and the extension walk (objectExtensionsByTarget(stack, storedExtensions)). In the walk a stored entry is folded in and never judged or located; the fill-back frombase(the target as served before the write, which carries the stored entries' fields as plain fields) skips the names they add, so a tied name is not served again as one sibling's definition. The call-site comment is rewritten to this reading. Neither edit touches the gate-setup region PR #33434 edits (its hunks at ~:2374-2380 and after ~:2396; this PR changes the one fold call between them, as the seat's surface amendment allows).packages/lint/src/formula-cycle-issues.ts.extensionFormulaLocireadsstored: a stored entry locates nothing, and a name it adds later in fold order than the written entry removes the written entry's locus (the sibling's definition is the one served). So a cycle a higher sibling closes through another field of the written entry is named on that field alone, and the sibling's member is never charged to the write.packages/lint/src/runtime-gate.ts,authoring-rules.ts,runtime.ts.runRuntimeAuthoringRules({ storedObjectExtensions })(optional) hands the list toAuthoringRuleContext.storedObjectExtensionson anobject_extensionwrite only, the same value in every pass; the expression rule passes it torunStackExpressionPasses.@objectstack/lint/runtimeexports theStoredObjectExtensiontype.packages/metadata-protocol/src/protocol-authoring-gate.ts,runtime-authoring-gate.ts. NewotherPackagesExtensionsOf(registry, target, writtenPackage): eachextendcontributor of the target (getObjectContributors) of a package other than the written one, with its priority and fields, in the registry's order; a disabled package's left out (isPackageDisabled, as every served fold withholds it);[]for a registry that cannot answer.judgeRuntimeAuthoringRulesstates it on anobject_extensionwrite (the target and packageobjectExtensionWriteFoldalready names) andevaluateRuntimeAuthoringGatepasses it through (optionalstoredObjectExtensions). Nopackages/specschema moves: the registry already held each sibling's package and priority.packages/spec/src/migrations/entries/semantic/18.object-extension-formula-cycle-refused.ts(PR #33442's entry, not yet released):reasonandacceptanceCriterianow state the door's fold, "at the priority that decides it" in place of "at the same priority", and the tie exception for both the build and the door on a declared object.content/docs/deployment/validating-metadata.mdx: the object extension paragraph's last sentence states the door's fold and "at the priority that decides it"..changeset/33494-extension-door-priority-fold.md:@objectstack/lint,@objectstack/metadata-protocoland@objectstack/specminor, both declaration lines, theSkills-docs:line, a BREAKING banner (Before / Now / Unchanged / Fix) andadr-0087: not-required (already-registered object-extension-formula-cycle-refused)(this PR updates that unreleased entry rather than registering a new one). Its Now paragraph corrects, by quotation, the pending.changeset/33153-extension-formula-cycle.mdNow clause and Unchanged sentence the carry note 6886038545 names, and "at the same priority" there. That changeset is not edited (it is another PR's).Why
Card #33494 (from PR #33442's contract review, record 6885259034 finding 1 and its observation): the door's snapshot (#33072) carried every other package's extension field on the target as a plain field with no priority, so the gate folded the written entry over all of them.
os buildfolds every package's entry by priority and serves the winner. The door refused a tie and an outranked entry the build accepts, and accepted a higher sibling's cycle through another field of the entry that the build refuses.Tests
packages/lint/src/runtime-gate.object-formula-cycle.test.ts: the A formula field an object extension adds that reads itself, or two that read each other, is refused at neither the publish door nor os build #33153 pin "the door judges the written entry's own definition whatever a sibling's priority" is replaced by a#33494describe (5 cases) at the real gate (runRuntimeAuthoringRules,type: 'object_extension', withstoredObjectExtensions) and the build (runAuthoringRules('build', …)over both packages):s__creading itself: no cycle finding at the door, none in the build.s__c = record.a__c + 1, the written entry (200) addss__c(number) anda__c = record.s__c * 2: refused at the door ona__conly, in the engine's sentence (formulaCycleMessage('a__c', ['a__c', 's__c'])); the build names the sibling'ss__cat the sibling's entry anda__cat the written entry.packages/runtime/src/domains/meta-object-extension-item.test.ts, new describe[#33494](4 cases) through the realsaveMetaItem+publishMetaItem, with a third package registered as an extender of the account (registerObjectExtension, priority 200 or 300): ⭐ the tie and the outranked self-reading formula publish (the row goes active), asos buildaccepts each; ⭐ shape 3 gets 422INVALID_METADATAwithexpression-invalidatobject 'crm_account' · objectExtensions[0] · field 'a__c' expressionand the row stays a draft; CONTROL: an entry outranking the sibling with a self-reading formula is still refused.packages/metadata-protocol/src/protocol-authoring-gate.extension-write-fold.test.ts, new describe[#33494](2 cases):otherPackagesExtensionsOflists every other package'sextendcontributor in the registry's order with its priority and fields, leaving out the owner, the written package and a disabled package; a registry with no contributors member, or one that throws, states none.validate-expressions.test.ts,validate-security-posture.test.ts, validate-expressions / validate-security-posture 也有同形的 spec 不声明键的??别名读法(#5009 建议 3 的核对结果) #5017 receiver scans):storedNames(a Set of names) andstored(the fold's list parameter) tabled as plumbing receivers, each with its reason.Red at base: the head's lint test file over the base lint sources (
git restore --source=41b64bb0of the six lint source files): 2 of 20 red, the shapes 1/2 case and the shape 3 LIT; restored withgit checkout HEAD --,git diff HEADempty.Ablations (one-shot through
node scripts/ablation-replace.mjson committed heade681d49f; each restore verdict "blob == HEAD andgit diff HEADis empty"; lint tests readsrc/):&& !storedNames.has(n)dropped): 1 of 20 red, the tied-name case.if (entry.stored) loci.delete(name)made unreachable behind aglobalThismarker): 1 of 20 red, the shape 3 LIT (the sibling'ss__ccharged to the write). A first attempt was a no-op (its replacement kept the anchor text; the tool refused and restored), so it was rerun with the marker.objectsAsServed(stack)): 2 of 20 red, shapes 1/2 and shape 3.dist/: the registry handed asglobalThis.__ablationR1(undefined) injudgeRuntimeAuthoringRules,pnpm --filter @objectstack/metadata-protocol run build,ablation-dist-preflightfound the marker indist/, runtime-t 33494: 3 red (both publish LITs and the shape 3 LIT), the CONTROL green. Restore leg: rebuilt,--absentfound no marker, 4/4 green. (A first R1 attempt was also a no-op for the same reason and is not counted.)Acceptance notes
packages/metadata-protocol/src/protocol-authoring-gate.ts(judgeRuntimeAuthoringRules), notpackages/runtime/src/domains/; the seat amended the claim's surface (6888588670).objectsAsServed/objectExtensionsByTargetwith the host's entries added to their input; the tie set and the ordering are the build's.isPackageDisabled), as the served fold leaves it out; an enable door'sasEnabledreading is not this write's.NS__NAMEfiling (extensionTargetKey, objectql: a manifest objectExtensions entry or hydrated row whose extend folds to a legacy key opens a second, owner-less object entry #28858) is not mirrored: the host reads the contributors under the target the body names, as the gate folds it.packages/specschemas; the door roster and its pins; PR fix(lint): the flow and hook publish doors stop requiring a null guard on the current row's created_at and updated_at in an ordering comparison #33434's hunks.Verification
Head
763105ec: the fixe681d49f, the meta-test tabling78ad84f3, the ADR-0087 markerdd37779e, and a merge oforigin/maine9884e19(base41b64bb0). PR #33434 landed before the merge; it merged clean, and both its stamped-column index and this PR'sobjectsAsServed(stack, storedExtensions)are on the merged line.Package tests
Run on head
763105ec(the merge oforigin/maine9884e19, which brought PR #33434) after a whole-repopnpm -r run build(VERDICT command-exit 0):@objectstack/lintpnpm test: 210/210 files, 8998/8998 tests;pnpm --filter @objectstack/lint typecheck(tsc + test typecheck) exit 0.@objectstack/metadata-protocolpnpm test: 340 files passed and 9 skipped, 22883 tests passed and 43 skipped;typecheckexit 0.@objectstack/runtimesrc/domains/meta-object-extension-item.test.ts: 50/50;pnpm --filter @objectstack/runtime typecheckexit 0.@objectstack/specsrc/migrations: 198/198 (round 0, one681d49f; the entry's text has not moved since).Gates (dispatch-gates --commands)
The derivation at
763105ecis 114 lines. Every line ran after the whole-repo build of763105ec, its exit code captured before any pipe, and all 114 exited 0.dispatch-gates --ran:114 derived, 114 run, 0 NOT-MEASURED, 0 UNRUN. The record ispm-orders/spec/33494-gates-ran.txtin the project share.Round 0 (head
78ad84f3, before the merge): the same 114 lines, 112 exit 0 and 2 red, each fixed and rerun green:check-adr-0087-registration(the changeset saidregisteredfor an entry that already existed; nownot-required (already-registered …), commitdd37779e) andcheck-plugin-teardown-shape --self-testexit 3 (the shallow clone lacked the pinned fixture commit;git fetch --depth=1 origin 621a4876…). Record:pm-orders/spec/33494-gates-ran-r0.txt.Dogfood (
Clause-②:carries the(narrowing)arm and the title!): full battery, the CI command (pnpm --filter @objectstack/dogfood testunder the verify lock), no shard, on head763105ecafter a whole-repo build. Result:VERDICT command-exit 0, Test Files 467 passed and 3 skipped (470), Tests 3958 passed and 42 skipped (4000), no failures. (Round 0 ondd37779e, before the merge: 467/3 files, 3953 passed and 42 skipped, no failures.)Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code